<?php
namespace App\Scopes\Admin;

use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Model;
use Hyperf\Database\Model\Scope;

Class Role implements Scope {

    public function apply(Builder $builder, Model $model)
    {
        $app = getApp();

        $builder->where('app', $app);
        if ($app === 'shop_id') {
            $builder->where('app_id', getInfo('shop', 'shop_id'));
        }
    }

}